/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biofilter.sources;

import biofilter.records.*;
import biofilter.exceptions.InvalidRecordException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Daniel Quest
 * @date   December 22nd 2009
 */
public class BowTieRecordsFileTest {

    public BowTieRecordsFileTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    BowTieRecordsFile btrf = null;
    @Before
    public void setUp() {
        try {
            //System.err.println(System.getProperty("user.dir").toString());
            btrf = new BowTieRecordsFile("./test/testdata/example.bowtie");
        } catch (InvalidRecordException ex) {
            Logger.getLogger(BowTieRecordsFileTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @After
    public void tearDown() {
    }

    
    @Test
    public void testeof(){
        System.out.println("eof");
        try {
            String result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	-	ctg93  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	419184	AANTTGACCGCCTGGGGAGTACGGTCGCAAGATTAAAACTC	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	-	ctg94  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	97654	AANTTGACCGCCTGGGGAGTACGGTCGCAAGATTAAAACTC	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	-	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	58243	AANTTGACCGCCTGGGGAGTACGGTCGCAAGATTAAAACTC	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	+	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	1786951	GAGTTTTAATCTTGCGACCGTACTCCCCAGGCGGTCAANTT	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:C>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	+	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	2816492	GAGTTTTAATCTTGCGACCGTACTCCCCAGGCGGTCAANTT	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:C>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	+	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	3048770	GAGTTTTAATCTTGCGACCGTACTCCCCAGGCGGTCAANTT	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:C>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_36_526	-	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	59739	TCNACCGATAGTGAACCAGTACCGTGAGGGAAAGGCGAAAA	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_36_526	-	ctg94  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	99290	TCNACCGATAGTGAACCAGTACCGTGAGGGAAAGGCGAAAA	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_36_526	-	ctg93  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	420820	TCNACCGATAGTGAACCAGTACCGTGAGGGAAAGGCGAAAA	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
            result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_36_526	+	ctg95  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	3047135	TTTTCGCCTTTCCCTCACGGTACTGGTTCACTATCGGTNGA	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:C>N");
            boolean b = btrf.eof;
            assertEquals(b, true);

        } catch (InvalidRecordException ex) {
            Logger.getLogger(BowTieRecordsFileTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Test
    public void testGetRecord(){
        System.out.println("getRecord");
        try {
            String result = btrf.getRecord().get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	-	ctg93  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	419184	AANTTGACCGCCTGGGGAGTACGGTCGCAAGATTAAAACTC	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
        } catch (InvalidRecordException ex) {
            Logger.getLogger(BowTieRecordsFileTest.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    @Test
    public void testPeek(){
        System.out.println("peek");
        try {
            Record r = btrf.peek();
            String result = r.get();
            assertEquals(result, "HWI-EAS127_3_4_1_774_879	-	ctg93  [organism=Burkholderia cenocepacia AU 1054] [tech=wgs] [gcode=11] [strain=AU 1054]	419184	AANTTGACCGCCTGGGGAGTACGGTCGCAAGATTAAAACTC	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII	2	38:G>N");
        } catch (InvalidRecordException ex) {
            Logger.getLogger(BowTieRecordsFileTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Test
    public void resetSource(){

    }

    @Test
    public void testSetSource(){

    }

}